using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using UnityEngine;
using UnityGameFramework.Runtime;

namespace LS
{
    public static class GameFrameworkComponentExtensions
    {
        public static bool IsNativeComponent(this GameFrameworkComponent component)
        {
            return component is not CustomGameFrameworkComponent &&
                    (
                        component is BaseComponent ||
                        component is ConfigComponent ||
                        component is DataNodeComponent ||
                        component is DebuggerComponent ||
                        component is DownloadComponent ||
                        component is EntityComponent ||
                        component is EventComponent ||
                        component is FileSystemComponent ||
                        component is FsmComponent ||
                        component is LocalizationComponent ||
                        component is NetworkComponent ||
                        component is ObjectPoolComponent ||
                        component is ProcedureComponent ||
                        component is ReferencePoolComponent ||
                        component is ResourceComponent ||
                        component is SceneComponent ||
                        component is SettingComponent ||
                        component is SoundComponent ||
                        component is UIComponent ||
                        component is WebRequestComponent
                    );
        }

        public static bool IsNativeComponentType<T>() where T: GameFrameworkComponent
        {
            return IsNativeComponentType(typeof(T));
        }

        public static bool IsNativeComponentType(Type type)
        {
            return type != typeof(CustomGameFrameworkComponent) &&
                    (
                        type == typeof(BaseComponent) ||
                        type == typeof(ConfigComponent) ||
                        type == typeof(DataNodeComponent) ||
                        type == typeof(DebuggerComponent) ||
                        type == typeof(DownloadComponent) ||
                        type == typeof(EntityComponent) ||
                        type == typeof(EventComponent) ||
                        type == typeof(FileSystemComponent) ||
                        type == typeof(FsmComponent) ||
                        type == typeof(LocalizationComponent) ||
                        type == typeof(NetworkComponent) ||
                        type == typeof(ObjectPoolComponent) ||
                        type == typeof(ProcedureComponent) ||
                        type == typeof(ReferencePoolComponent) ||
                        type == typeof(ResourceComponent) ||
                        type == typeof(SceneComponent) ||
                        type == typeof(SettingComponent) ||
                        type == typeof(SoundComponent) ||
                        type == typeof(UIComponent) ||
                        type == typeof(WebRequestComponent)
                    );
        }
    }
}
